﻿using System;
using System.Reflection;
namespace Protocol.SouthGridProtocol.Decoder
{
    public class DadaReflectionDecoder
    {
        //private string di;
        //public DadaReflectionDecoder(string di)
        //{
        //    this.di = di;
        //}

        /// <summary>
        /// 反射调用方法解析对应di内容
        /// </summary>
        /// <param name="diName">diName(高在前低在后)</param>
        /// <param name="dataValue">低在前高在后</param>
        /// <returns></returns>
        public static string ReflectionCallMethod(string diName,string dataValue)
        {
            Assembly ass=Assembly.GetExecutingAssembly();
            Type type = typeof(ParamsDecoder);
            MethodInfo method = type.GetMethod(diName);
            Object obj = ass.CreateInstance("Protocol.SouthGridProtocol.Decoder.ParamsDecoder");
            Object[] parametors = new Object[] { dataValue };  
            return method.Invoke(obj,parametors) as string;// 
        }
    }
}
